package crazy.interfacee;

public class TestComposite
{
	public static void main(String[] args)
	{
		Animal1 a1 = new Animal1();
		Bird1 b1 = new Bird1(a1);
		b1.breath();
		b1.fly();
		
		Animal1 a2 = new Animal1();
		Wolf1 w1 = new Wolf1(a2);
		w1.breath();
		w1.run();
	}
}

class Animal1
{
	private void beat()
	{
		System.out.println("beat");
	}
	public void breath()
	{
		beat();
		System.out.println("beath");
	}
}

class Bird1
{
	private Animal1 a;
	
	public Bird1(Animal1 a)
	{
		this.a = a;
	}
	
	public void breath()
	{
		a.breath();
	}
	
	public void fly()
	{
		System.out.println("fly");
	}
}

class Wolf1
{
	private Animal1 a;
	
	public Wolf1(Animal1 a )
	{
		this.a = a;
	}
	
	public void breath()
	{
		a.breath();
	}
	
	public void run()
	{
		System.out.println("run");
	}
	
	
}
